<template>
  <div class="flex_sb width_100">
    <el-input-number
      :precision="precision"
      :controls="false"
      type="number"
      :min="minV"
      :max="vEnd ? vEnd : maxV"
      v-model="vStart"
      placeholder="请输入"
      class="number"
    />
    <span class="post">-</span>
    <el-input-number
      :precision="precision"
      :controls="false"
      type="number"
      :min="vStart"
      :max="maxV"
      v-model="vEnd"
      placeholder="请输入"
      class="number"
    />
  </div>
</template>

<script setup lang="ts">
  /**
   * @import
   */

  /**
   * @porps
   */

  defineProps({
    // 最大值
    maxV: {
      type: Number,
      default: 10000 * 10000,
    },
    minV: {
      type: Number,
      default: 0,
    },
    //数值精度
    precision: {
      type: Number,
      default: 0,
    },
  })

  const vStart = ref<any>('')
  const vEnd = ref<any>('')

  /**
   * @var
   */

  /**
   * @method
   */

  //  重置
  const reset = () => {
    vStart.value = ''
    vEnd.value = ''
  }

  defineExpose({
    vStart,
    vEnd,
    reset,
  })

  onMounted(() => {
    reset()
  })
</script>

<style scoped lang="scss">
  .post {
    padding: 0 4px;
  }

  .number {
    width: 47%;
  }
</style>
